<?php
//判断是否已经安装
if(!file_exists('../install/install.lock')){
	header('location:../install/install1.php');
	exit;
}
//包含网站配置文件
include '../public/wzconfig.php';
if(WZ_KG == 0){
	header('location:./outwz.php');
	exit;
}
?>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title><?php echo WZ_TITLE;?></title>
		<link href="css/index.css" rel="stylesheet" type="text/css">
		<link href="css/public.css" rel="stylesheet" type="text/css">
	</head>
	<body>
		<div id="div1">
			<?php 
				include './includes/header.inc.php';
			?>
			<!--主体内容区域-->
			<div id="main">
				<div class="clear"></div>
				<div class="main_d"></div>
				<?php
					//查询新注册的用户名
					$newsql = "select username from user where id={$_SESSION['newid']}";
					//执行sql
					$newres = mysqli_query($link,$newsql);
					//判断结果集
					if($newres && mysqli_num_rows($newres)){
						$newinfo = mysqli_fetch_assoc($newres);
						//释放结果集
						mysqli_free_result($newres);
					}
				?>
				<div class="main_e">今日:1520 | 昨日:1520 | 帖子:1520 | 会员:1520 | 欢迎新会员:<?php echo $newinfo['username']?></div>
				<div class="clear"></div>
					<div id="main_two">
						<?php
							//准备查询分区sql
							$psql = "select id,pname from part";
							//执行sql
							$pres = mysqli_query($link, $psql);
							//判断结果集
							if($pres && mysqli_num_rows($pres)){
								while($pinfo = mysqli_fetch_assoc($pres)){
						?>
						<div id="main_two_top">
							<div class="left"><?php echo $pinfo['pname']?></div>
							<div class="right">分区版主：ABC</div>
						</div>
								<?php
									//查询分区下的版块 根据分区id去查  cate.pid = 分区id
									$csql = "select id,pid,cname from cate where pid={$pinfo['id']}";
									//执行sql
									$cres = mysqli_query($link, $csql);
									//判断结果集
									if($cres && mysqli_num_rows($cres)){
										while($cinfo = mysqli_fetch_assoc($cres)){	
								?>
								<div id="main_center">
							<div class="img"><img src="./images/forum_new.gif"></div>
							<table>
								<tr>
									
									<td><a href="list.php?cid=<?php echo $cinfo['id']?>"><?php echo $cinfo['cname'];?></a></td>
								</tr>
								<tr>
									<td><span>主贴:54,帖子:244</span></td>
								</tr>
								<tr>
									<td><span>最后发表:2012-11-1 10:22</span></td>
								</tr>
							</table>
						</div>
						<?php
										}
									}
								}
							}
						?>
					</div>
				<div class="clear"></div>
			</div>
			<!--底部 友链 版权-->
			<?php 
				include './includes/footer.inc.php';
			?>
		</div>
	</body>
</html>